
malloc-struct.o:     file format elf64-littleaarch64


Disassembly of section .text:

0000000000000000 <main>:
	char name[10];
	int age;
}son;

void main()
{
   0:	a9bd7bfd 	stp	x29, x30, [sp, #-48]!
   4:	910003fd 	mov	x29, sp
	struct stu student1;
	struct stu * p;
	son * pson;

	strcpy(student1.name, "xiaozhi");
   8:	910043a0 	add	x0, x29, #0x10 ; x0 = x29+0x10
   c:	90000001 	adrp	x1, 0 <main> 
  10:	91000021 	add	x1, x1, #0x0 ; "xiaozhi"
  14:	f9400021 	ldr	x1, [x1]     ; x1 = "xiaozhi"
  18:	f9000001 	str	x1, [x0]     ; student1.name="xiaozhi"
	student1.age = 35;
  1c:	52800460 	mov	w0, #0x23                  	// #35
  20:	b9001fa0 	str	w0, [x29, #28]              ; student1.age
	printf("student1 name is : %s\n",student1.name);
  24:	910043a1 	add	x1, x29, #0x10             ; student1.name
  28:	90000000 	adrp	x0, 0 <main>
  2c:	91000000 	add	x0, x0, #0x0
  30:	94000000 	bl	0 <printf>
	printf("student1 age is : %d\n",student1.age);
  34:	b9401fa1 	ldr	w1, [x29, #28]           ; student1.age
  38:	90000000 	adrp	x0, 0 <main>
  3c:	91000000 	add	x0, x0, #0x0
  40:	94000000 	bl	0 <printf>

	p = (struct stu *) malloc (sizeof(struct stu));
  44:	d2800200 	mov	x0, #0x10                  	// #16
  48:	94000000 	bl	0 <malloc>
  4c:	f90017a0 	str	x0, [x29, #40] ; p
	strcpy(p->name, "zixi");
  50:	f94017a2 	ldr	x2, [x29, #40] ; p
  54:	90000000 	adrp	x0, 0 <main>
  58:	91000001 	add	x1, x0, #0x0 ; "zixi"
  5c:	aa0203e0 	mov	x0, x2       ; x0 = p
  60:	b9400022 	ldr	w2, [x1]     ; "zixi"
  64:	b9000002 	str	w2, [x0]     ; p = zixi
  68:	b8401021 	ldur	w1, [x1, #1]
  6c:	b8001001 	stur	w1, [x0, #1]
	p->age = 2;
  70:	f94017a0 	ldr	x0, [x29, #40] ; p
  74:	52800041 	mov	w1, #0x2       // #2
  78:	b9000c01 	str	w1, [x0, #12]  ; p->age
	printf("student2 name is : %s\n",p->name);
  7c:	f94017a1 	ldr	x1, [x29, #40]       ; p
  80:	90000000 	adrp	x0, 0 <main>
  84:	91000000 	add	x0, x0, #0x0
  88:	94000000 	bl	0 <printf>
	printf("student2 age is : %d\n",p->age);
  8c:	f94017a0 	ldr	x0, [x29, #40]     ; p
  90:	b9400c01 	ldr	w1, [x0, #12]      ; p+12
  94:	90000000 	adrp	x0, 0 <main>
  98:	91000000 	add	x0, x0, #0x0
  9c:	94000000 	bl	0 <printf>

	pson = (son *) malloc (sizeof (son));
  a0:	d2800200 	mov	x0, #0x10                  	// #16
  a4:	94000000 	bl	0 <malloc>
  a8:	f90013a0 	str	x0, [x29, #32]
	strcpy(pson->name, "zhen");
  ac:	f94013a2 	ldr	x2, [x29, #32] ; stack
  b0:	90000000 	adrp	x0, 0 <main>
  b4:	91000001 	add	x1, x0, #0x0
  b8:	aa0203e0 	mov	x0, x2
  bc:	b9400022 	ldr	w2, [x1]
  c0:	b9000002 	str	w2, [x0]
  c4:	b8401021 	ldur	w1, [x1, #1]
  c8:	b8001001 	stur	w1, [x0, #1]
	pson->age = 3;
  cc:	f94013a0 	ldr	x0, [x29, #32]
  d0:	52800061 	mov	w1, #0x3                   	// #3
  d4:	b9000c01 	str	w1, [x0, #12]

	printf("son name is : %s\n",pson->name);
  d8:	f94013a1 	ldr	x1, [x29, #32]
  dc:	90000000 	adrp	x0, 0 <main>
  e0:	91000000 	add	x0, x0, #0x0
  e4:	94000000 	bl	0 <printf>
	printf("son age is : %d\n",pson->age);
  e8:	f94013a0 	ldr	x0, [x29, #32]
  ec:	b9400c01 	ldr	w1, [x0, #12]
  f0:	90000000 	adrp	x0, 0 <main>
  f4:	91000000 	add	x0, x0, #0x0
  f8:	94000000 	bl	0 <printf>

	free(p);
  fc:	f94017a0 	ldr	x0, [x29, #40]
 100:	94000000 	bl	0 <free>
	free(pson);
 104:	f94013a0 	ldr	x0, [x29, #32]
 108:	94000000 	bl	0 <free>
	p = NULL;
 10c:	f90017bf 	str	xzr, [x29, #40]
	pson = NULL;
 110:	f90013bf 	str	xzr, [x29, #32]

}
 114:	d503201f 	nop
 118:	a8c37bfd 	ldp	x29, x30, [sp], #48
 11c:	d65f03c0 	ret
